#ifndef INPUTMAPTAB_H
#define INPUTMAPTAB_H

#include <QWidget>
#include <QCheckBox>
#include <QPushButton>
#include <QMap>
#include <QLabel>
#include <QSlider>
#include <QProgressBar>
#include "InputEventFilter.h"
#include "InputTypes.h"
#include "InputMapping.h"

class InputMapTab : public QWidget
{
  Q_OBJECT

public:
  InputMapTab(QWidget* parent = 0, unsigned int inputNumber=0,
              InputMapping* defaultMapping = new InputMapping());

  InputMapping* inputMapping() const;

public slots:
  void enableInput(bool enable);
  void changeButtonMapping();
  void waitButton(ButtonType k);
  void changeSliderMapping();
  void waitSlider(HalfAxisType a, int value);
  void waitSlider(ButtonType a);
  void slider(QString name, int value);
  void buttonPress(QString name);
  void buttonRelease(QString name);

private:
  void disableButtons(bool disabled);
  void disableAnalogSliders(bool disabled);

  QCheckBox mEnableBox;
  QList<QPushButton*> mButtons;
  QList<QLabel*> mButtonLabels;
  QMap<QString, QProgressBar*> mProgressBars;
  QPushButton* mMappingButton;

  QMap<QString, QSlider*> mAnalogSliders;
  QList<QPushButton*> mAnalogButtons;
  QList<QLabel*> mAnalogSliderLabels;
  QPushButton* mMappingSlider;
  bool mSliderp2;

  InputEventFilter mInputFilter;
  InputMapping* mInputMapping;
};

#endif
